package leetcode;

/**
 * @author yinlei
 * @date 2018/6/20
 * @since 1.0.0
 */
public class N010RegularExpressionMatching {

    public static void main(String[] args) {
        // todo 学习动态变化思路
    }

    // 处理.和*
    static public boolean isMatch(String s, String p) {
        char[] pArr = p.toCharArray();
        char[] sArr = s.toCharArray();

        int sIndex = 0;
        int sSize = sArr.length;
        for (int pi = 0, pn = pArr.length; pi < pn; pi++) {
            char pc = pArr[pi];
            boolean all = false;
            boolean more = false;
            if (pc == '.') {
                all = true;
            }
            if (pi + 1 < pn && pArr[pi + 1] == '*') {
                more = true;
            }

            while (sIndex < sSize) {
                char sc = sArr[sIndex];

                if (sc == pc || all || more)

                sIndex++;
            }
        }

        return false;
    }
}
